import logs from '../../resource/data/walletLogs'
export default {
  loadLogs (payload) {
    console.log(payload)
    const {ps, pn, type} = payload
    let res = logs
    if (type === 1) {
      res = logs.filter(log => log.money > 0)
    } else if (type === 2) {
      res = logs.filter(log => log.money < 0)
    }
    const start = (pn - 1) * ps
    const end = pn * ps
    const len = res.length
    if (start > len) {
      res = []
    }
    res = res.slice(start, Math.min(len, end))
    return new Promise(resolve => {
      setTimeout(resolve, 300, res)
    })
  }
}
